﻿using System;

class ReverseDecimalDigits
{
    static void Main()
    {
        decimal N;
        
        bool iProvided = false;
        do
        {
            if (iProvided == true) Console.WriteLine("Error!: Invalid input. Please enter a valid decimal. \r\nValid range: {0} - {1}", decimal.MinValue, decimal.MaxValue);
            else iProvided = true;
            Console.Write("Please provide an integer number: ");
        } while (decimal.TryParse(Console.ReadLine(), out N) == false);

        Console.WriteLine(ReverseDigits(N));
    }

    private static string ReverseDigits(decimal number)
    {
        string reversed = "";
        string straightstr = number.ToString();
        //string numberstr = 
        for (int i = straightstr.Length-1; i >= 0; i--) reversed += straightstr[i];
        return reversed;
    }
}
